<?php include 'application/views/header.php' ?>
<h4 class="page-title">Nhóm tin tức</h4>
<div class="toolbar-set">
    <input type="button" class="btnAdd" value="Thêm nhóm tin tức" />
</div>
<table width="100%" class="list group-news">
    <tr>
        <th>STT</th>
        <th>Tiêu đề của nhóm tin tức</th>
        <th>Mã nhóm tin tức</th>
        <th>Thuộc nhóm tin lớn</th>
        <th>Trang mặt định</th>
        <th>Thao tác</th>
    </tr>
    <?php $index = 1 ?>
    <?php foreach($Articlecategories as $articlecategory): ?>    
    <tr>
       <td><?php echo $index++ ?></td>
       <td><?php echo show_space($articlecategory['NewsCategoryLevel']).' '.$articlecategory['NewsCategoryName'] ?></td>
       <td><?php echo $articlecategory['NewsCategoryCode'] ?></td>
       <td><?php echo $articlecategory['ParentName'] ?></td>
       <td><a href="<?php echo base_url() ?>article/edit/<?php echo $articlecategory['NewsId'] ?>.html"><?php echo $articlecategory['NewsTitle'] ?></a></td>
       <td>
            <a href="<?php echo base_url() ?>articlecategory/edit/<?php echo $articlecategory['NewsCategoryId'] ?>.html">
                <div class="actEdit">Edit</div>
            </a>
            <a href="#">
                <div class="actDelete" articleCategoryId="<?php echo $articlecategory['NewsCategoryId'] ?>">Edit</div>
            </a>
       </td>
    </tr>
    <?php endforeach; ?>
</table>
<div class="toolbar-set">
    <input type="button" class="btnAdd" value="Thêm nhóm tin tức" />
</div>

<?php include 'application/views/footer.php' ?>

<script>
$('.btnAdd').click(function(){
    window.location.href = '<?php echo base_url() ?>articlecategory/add.html'; 
});
$('.actDelete').click(function(){
    var articlecategoryId = $(this).attr('articleCategoryId');
    if(confirm("Bạn có muốn xóa không?")){
        window.location.href = '<?php echo base_url() ?>articlecategory/delete/'+articlecategoryId;
    }
    return false;
});
</script>